package vn.info.vietnaminfo.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper
{	
	private static final String DATABASE_NAME = "VNInfo.db";
    private static final int DATABASE_VERSION = 1;

    public DBHelper(Context context)
    {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db)
    {
    	db.beginTransaction();
        try
        {
            for (String table : CREATE_TABLE)
            {
                db.execSQL(table);
            }
            db.setTransactionSuccessful();
        }
        finally
        {
            db.endTransaction();
        }
    }

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
	{
		onCreate(db);
	}
	
	private final String[] CREATE_TABLE = new String[]
	{
		DaoLoaiHinhKD.CREATE_TABLE, DaoDiaDiem.CREATE_TABLE
	};
}